const router = require('express').Router()
const {db,pool}=require('../db/db')
const fs = require('fs')
const noticeSQL = require('../db/noticeSQL')
const {getList: MN} = require('../middleware/notice')
const { getList: CN} = require('../controller/notice')
router.get('/info',MN,CN)
router.post('/submit', (req, res, next) => {
  pool.query(noticeSQL.insert,[req.body.content],(err,result)=>{undefined
    if(err) throw err;
    console.log(result);
  });
  res.send()
})
router.post('/remove',(req,res,next)=>{
  pool.query(noticeSQL.delete,[req.body.noticeId],(err,result)=>{undefined
    if(err) throw err;
    console.log(result);
  });
  res.send()
})

module.exports=router
